using System;
using System.Collections.Generic;
using Microsoft.WowAddonStudio.FrameXml.Components;
using Microsoft.WowAddonStudio.FrameXml.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames;

namespace Microsoft.WowAddonStudio.FrameXml.Design.Services.NameCreationService
{
	/// <summary>
	/// 
	/// </summary>
	public sealed class DataTypeMapper
	{
		#region Mapper Initialization

		private static readonly Dictionary<Type, Type> controlMap = new Dictionary<Type, Type>
		                                                            	{
		                                                            		{typeof (UiControl), typeof (Ui)},
		                                                            		{typeof (LayoutFrameControl), typeof (LayoutFrame)},
		                                                            		{typeof (FrameControl), typeof (Frame)},
		                                                            		{typeof (TextureControl), typeof (Texture)},
		                                                            		{typeof (FontStringControl), typeof (FontString)},
		                                                            		{typeof (ButtonControl), typeof (Button)},
		                                                            		{typeof (CheckButtonControl), typeof (CheckButton)},
		                                                            		{typeof (EditBoxControl), typeof (EditBox)},
		                                                            		{typeof (ColorSelectControl), typeof (ColorSelect)},
		                                                            		{typeof (StatusBarControl), typeof (StatusBar)},
		                                                            		{typeof (SliderControl), typeof (Slider)},
		                                                            		{typeof (ScrollFrameControl), typeof (ScrollFrame)},
		                                                            		{typeof (MessageFrameControl), typeof (MessageFrame)},
		                                                            		{typeof (ScrollingMessageFrameControl), typeof (ScrollingMessageFrame)},
		                                                            		{typeof (MinimapControl), typeof (Minimap)},
		                                                            		{typeof (PlayerModelControl), typeof (PlayerModel)},
		                                                            		{typeof (TabardModelControl), typeof (TabardModel)},
		                                                            		{typeof (ModelControl), typeof (Model)},
		                                                            		{typeof (SimpleHTMLControl), typeof (SimpleHTML)},
		                                                            		{typeof (TaxiRouteFrameControl), typeof (TaxiRouteFrame)},
		                                                            		{typeof (WorldFrameControl), typeof (WorldFrame)}
		                                                            	};

		#endregion
        
		/// <summary>
		/// Gets the <see cref="System.Type"/> with the specified type.
		/// </summary>
		/// <value></value>
		public Type this[Type type]
		{
			get
			{
				Type controlType;
				if (!ControlMap.TryGetValue(type, out controlType))
				{
					controlType = type;
				}
				return controlType;
			}
		}

		/// <summary>
		/// Gets the control map.
		/// </summary>
		/// <value>The control map.</value>
		private static Dictionary<Type, Type> ControlMap
		{
			get { return controlMap; }
		}
	}
}